using UnityEngine;
// [Assembly-CSharp.dll].DrawingManager
public class DrawingManager : MonoBehaviour
{
    // Fields
    private bool ExceptionHandling;
    private UnityEngine.LineRenderer pathLineRenderer;
    private UnityEngine.EdgeCollider2D pathEdgeCollider;
    private UnityEngine.PolygonCollider2D pathPolygonCollider;
    private UnityEngine.Rigidbody2D pathRigidbody;
    private UnityEngine.Color c1;
    private UnityEngine.Color c2;
    public int posCount;
    private float destroyCounter;
    public static int cloneNumber;
    private float colliderAngle;
    public System.Collections.Generic.List<UnityEngine.Vector2> newVerticies;
    private System.Collections.Generic.List<UnityEngine.Vector2> newVerticies2;
    private System.Collections.Generic.List<UnityEngine.Vector2> newVerticies_;
    public UnityEngine.GameObject path;
    public UnityEngine.GameObject massCenter;
    public UnityEngine.GameObject mousePointer;
    private UnityEngine.GameObject massCenterClone;
    private UnityEngine.GameObject clone;
    public UnityEngine.Vector2 centerOfMass;
    private int centerOfMassCount;
    private UnityEngine.RaycastHit2D hit;
    private UnityEngine.RaycastHit2D mouseRay;
    public UnityEngine.LayerMask layerMask;
    private bool mouseHit;
    public bool canDraw;
    public UnityEngine.Color colorStart;
    public UnityEngine.Color colorEnd;
    public UnityEngine.PhysicsMaterial2D material;
    public float widthStart;
    public float widthEnd;
    public float verticesDistance;
    public bool fixedPosition;
    public bool isPermanent;
    public float lifeTime;
    public ColliderTypeChoices colliderType;
    public bool showMassCenter;
    public int massCenterPrecision;
    public bool dynamicMass;
    public float massScale;
    public float gravityScale;
    public bool freezeWhileDrawing;
    public UnityEngine.LineRenderer blockLine;
    public string tagCantDraw;
    private string[] tagsCantdraw;
    public UnityEngine.Material lineMaterial;
    public UnityEngine.GameObject pointPrefab;
    private bool prepareDrawFinish;
    private UnityEngine.Vector2 touchDownPosition;
    private bool isBeginDrawOnTouch;
    private bool drawSound;
    private bool isEnded;
    
    // Methods
    private void Start()
    {
        UnityEngine.Physics2D.IgnoreLayerCollision(layer1:  UnityEngine.LayerMask.NameToLayer(layerName:  -1610604795), layer2:  UnityEngine.LayerMask.NameToLayer(layerName:  -1610604795));
        this.mousePointer = UnityEngine.GameObject.Find(name:  -1610605291);
        mem2[0] = 0;
        mem2[0] = ;
        mem2[0] = ;
        mem[1152921504930430720] = 1036831949;
        mem[1152921504930430728] = 1073741824;
        mem[1152921504930430724] = 256;
        mem[1152921504930430740] = 100;
        mem[1152921504930430736] = 0;
        mem[1152921504930430744] = 1;
        mem[1152921504930430752] = 1065353216;
        mem[1152921504930430756] = 0;
        if(mem[536881037] != 0)
        {
                mem[536881045] = 44;
            this.tagsCantdraw = this.tagCantDraw.Split(separator:  536881013);
            this.pathLineRenderer = this.path.GetComponent<System.Object>();
            this.pathLineRenderer.useWorldSpace = false;
            this.pathLineRenderer.material = this.lineMaterial;
            this.posCount = 0;
            this.ExceptionHandling = false;
            return;
        }
    
    }
    private void FixedUpdate()
    {
        UnityEngine.Vector3 val_3 = UnityEngine.Input.mousePosition;
        UnityEngine.Vector3 val_4 = UnityEngine.Camera.main.ScreenToWorldPoint(position:  new UnityEngine.Vector3() {x = val_3.x, y = val_3.y, z = val_3.z});
        this.mousePointer.GetComponent<System.Object>().target = new UnityEngine.Vector2();
    }
    private void initCanDraw()
    {
        if(this.mouseRay.collider != 0)
        {
                this.canDraw = false;
        }
        
        if((UnityEngine.EventSystems.EventSystem.current.IsPointerOverGameObject(pointerId:  0)) == false)
        {
                return;
        }
        
        this.canDraw = false;
    }
    public void setBlockLine(UnityEngine.Vector3 begin, UnityEngine.Vector3 end)
    {
        UnityEngine.Vector3 val_1 = this.blockLine.GetPosition(index:  0);
        this.blockLine.SetPosition(index:  0, position:  new UnityEngine.Vector3() {x = begin.x, y = begin.y, z = val_1.z});
        this.blockLine.SetPosition(index:  1, position:  new UnityEngine.Vector3() {x = end.x, y = end.y, z = val_1.z});
    }
    private void prepareDraw()
    {
        UnityEngine.Vector3 val_3 = UnityEngine.Input.mousePosition;
        UnityEngine.Vector3 val_4 = UnityEngine.Camera.main.ScreenToWorldPoint(position:  new UnityEngine.Vector3() {x = val_3.x, y = val_3.y, z = val_3.z});
        this.mousePointer.transform.position = new UnityEngine.Vector3() {x = val_4.x, y = val_4.y, z = val_4.z};
        this.mousePointer.GetComponent<System.Object>().isTrigger = true;
        this.mousePointer.transform.localScale = new UnityEngine.Vector3() {x = this.widthEnd, y = this.widthEnd, z = this.widthEnd};
        this.StarPrefab();
        this.centerOfMassCount = 0;
        this.prepareDrawFinish = true;
        this.centerOfMass = mem[536895699];
    }
    private void drawing()
    {
        var val_5;
        if(this.hit.collider != 0)
        {
                if(this.hit.collider.isTrigger == false)
        {
            goto label_4;
        }
        
        }
        
        val_5 = 0;
        goto label_5;
        label_4:
        val_5 = 1;
        label_5:
        this.mouseHit = true;
        this.DrawVisibleLine();
    }
    private void initDrawWhenTouch()
    {
        var val_7;
        var val_8;
        val_7 = 2;
        mem2[0] = 0;
        mem2[0] = val_7;
        val_8 = 0;
        val_7 = val_7 + 1;
        mem2[0] = val_7;
        if(1 < mem[536895577])
        {
                var val_2 = 536895553 + 8;
            mem2[0] = 1 + 1;
            mem2[0] = mem[536895737];
            mem2[0] = mem[536895737] + 4;
        }
        
        UnityEngine.Vector3 val_5 = UnityEngine.Input.mousePosition;
        UnityEngine.Vector3 val_6 = UnityEngine.Camera.main.ScreenToWorldPoint(position:  new UnityEngine.Vector3() {x = val_5.x, y = val_5.y, z = val_5.z});
        this.mousePointer.transform.position = new UnityEngine.Vector3() {x = val_6.x, y = val_6.y, z = val_6.z};
        UnityEngine.Vector3 val_8 = this.mousePointer.transform.position;
        this.touchDownPosition = val_8.x;
        mem[1152921504930430808] = val_8.y;
    }
    private void onTouchDown()
    {
        mem2[0] = 1;
        this.prepareDrawFinish = false;
        mem2[0] = 0;
        mem2[0] = W10 + 1;
        this.canDraw = true;
        this.isBeginDrawOnTouch = false;
        this.initCanDraw();
        if(this.canDraw == false)
        {
                return;
        }
        
        this.initDrawWhenTouch();
    }
    private void onTouchMove()
    {
        if(this.prepareDrawFinish != true)
        {
                this.canDraw = true;
            this.initCanDraw();
        }
        
        if(this.canDraw == false)
        {
                return;
        }
        
        if(this.isBeginDrawOnTouch != false)
        {
                this.drawing();
            return;
        }
        
        UnityEngine.Vector3 val_2 = UnityEngine.Input.mousePosition;
        UnityEngine.Vector3 val_3 = UnityEngine.Camera.main.ScreenToWorldPoint(position:  new UnityEngine.Vector3() {x = val_2.x, y = val_2.y, z = val_2.z});
        UnityEngine.Vector2 val_6 = this.touchDownPosition;
        val_6 = val_3.x - val_6;
        val_3.x = val_6 * val_6;
        val_3.x = val_3.x + ((val_3.y - S11) * (val_3.y - S11));
        if(val_3.x <= 0.05f)
        {
                return;
        }
        
        if(this.prepareDrawFinish != false)
        {
                return;
        }
        
        this.isBeginDrawOnTouch = true;
        this.prepareDraw();
    }
    public void EndLevel()
    {
        this.onTouchUp();
    }
    private void onTouchUp()
    {
        UnityEngine.GameObject val_13;
        this.ExceptionHandling = false;
        this.isEnded = true;
        mem2[0] = 0;
        this.setBlockLineVisiable(visiable:  false);
        if(this.canDraw == false)
        {
            goto label_28;
        }
        
        if(this.isBeginDrawOnTouch == false)
        {
            goto label_2;
        }
        
        this.mousePointer.GetComponent<System.Object>().isTrigger = true;
        this.makeLinePhysics();
        this.clone.layer = UnityEngine.LayerMask.NameToLayer(layerName:  -1610608097);
        this.posCount = 0;
        if(this.newVerticies >= 3)
        {
                if((this.widthStart != 0f) || (this.widthEnd != 0f))
        {
            goto label_28;
        }
        
        }
        
        var val_13 = mem[536885469];
        val_13 = val_13 - 1;
        mem2[0] = val_13;
        UnityEngine.Object.Destroy(obj:  this.clone);
        UnityEngine.Vector3 val_4 = this.mousePointer.transform.position;
        this.makeAPoint(position:  new UnityEngine.Vector3() {x = val_4.x, y = val_4.y, z = 0f});
        label_28:
        mem2[0] = 0;
        if(this.fixedPosition == true)
        {
            goto label_15;
        }
        
        val_13 = this.clone;
        if((UnityEngine.Object.op_Implicit(exists:  val_13)) == false)
        {
            goto label_15;
        }
        
        Unknown val_7 = this.clone.gameObject.AddComponent<System.Object>();
        goto label_20;
        label_15:
        val_13 = this.pathRigidbody;
        if((UnityEngine.Object.op_Implicit(exists:  val_13)) != false)
        {
                this.pathRigidbody.bodyType = 2;
        }
        
        label_20:
        if(this.ExceptionHandling != false)
        {
                return;
        }
        
        this.gameObject.SetActive(value:  false);
        return;
        label_2:
        UnityEngine.Vector3 val_11 = UnityEngine.Input.mousePosition;
        UnityEngine.Vector3 val_12 = UnityEngine.Camera.main.ScreenToWorldPoint(position:  new UnityEngine.Vector3() {x = val_11.x, y = val_11.y, z = val_11.z});
        this.makeAPoint(position:  new UnityEngine.Vector3() {x = val_12.x, y = val_12.y, z = 0f});
    }
    private void makeLinePhysics()
    {
        var val_21;
        var val_22;
        float val_23;
        float val_24;
        float val_41;
        System.Collections.Generic.List<UnityEngine.Vector2> val_43;
        float val_44;
        float val_45;
        float val_46;
        float val_47;
        UnityEngine.Rigidbody2D val_48;
        float val_49;
        float val_50;
        this.pathPolygonCollider.isTrigger = false;
        ColliderTypeChoices val_42 = this.colliderType;
        if(val_42 != 1)
        {
            goto label_2;
        }
        
        UnityEngine.Vector3 val_2 = this.mousePointer.transform.position;
        val_41 = val_2.x;
        UnityEngine.Vector3 val_4 = this.clone.transform.position;
        var val_5 = W10 + 1;
        mem2[0] = val_5;
        val_4.x = val_41 - val_4.x;
        val_4.y = val_2.y - val_4.y;
        if(val_5 >= W11)
        {
            goto label_20;
        }
        
        val_42 = val_42 + (((W10 + 1)) << 3);
        mem2[0] = val_5 + 1;
        mem2[0] = val_4.x;
        mem2[0] = val_4.y;
        goto label_20;
        label_2:
        System.Collections.Generic.List<UnityEngine.Vector2> val_43 = this.newVerticies2;
        mem2[0] = 0;
        mem2[0] = W9 + 1;
        UnityEngine.Vector3 val_9 = this.mousePointer.transform.position;
        val_41 = val_9.x;
        UnityEngine.Vector3 val_11 = this.clone.transform.position;
        var val_12 = W10 + 1;
        mem2[0] = val_12;
        val_11.x = val_41 - val_11.x;
        val_11.y = val_9.y - val_11.y;
        if(val_12 < W11)
        {
                val_43 = val_43 + (((W10 + 1)) << 3);
            mem2[0] = val_12 + 1;
            mem2[0] = val_11.x;
            mem2[0] = val_11.y;
        }
        
        val_43 = this.newVerticies;
        var val_47 = 0;
        val_44 = 0.5f;
        label_37:
        var val_46 = 20180991;
        if(val_47 >= val_46)
        {
            goto label_22;
        }
        
        if(val_47 < 20180990)
        {
                Unknown val_14 = val_43.Item[0];
            int val_15 = val_47 + 1;
            Unknown val_16 = this.newVerticies.Item[val_15];
            Unknown val_17 = this.newVerticies.Item[0];
            Unknown val_18 = this.newVerticies.Item[val_15];
            float val_20 = val_11.x - val_11.x;
            val_43 = this.newVerticies;
            val_45 = (val_11.y - val_11.y) + 1.570796f;
            this.colliderAngle = val_45;
            val_46 = val_21;
            val_47 = val_22;
        }
        else
        {
                val_45 = this.colliderAngle;
            val_46 = val_23;
            val_47 = val_24;
        }
        
        Unknown val_25 = val_43.Item[0];
        float val_44 = 0f;
        val_44 = val_44 / ((float)W27 - 2);
        float val_45 = 1f;
        Unknown val_28 = this.newVerticies.Item[0];
        val_12 = val_12 + 1;
        mem2[0] = val_12;
        float val_29 = this.widthEnd - this.widthStart;
        val_29 = val_29 * ((val_44 >= 0) ? (val_45) : 0f);
        val_29 = this.widthStart + val_29;
        val_29 = val_29 * val_44;
        val_46 = val_46 * val_29;
        val_47 = val_47 * val_29;
        val_29 = val_45 + val_46;
        val_45 = val_47 + val_45;
        if(val_12 < 0)
        {
                val_46 = val_46 + ((((W10 + 1) + 1)) << 3);
            mem2[0] = val_12 + 1;
            mem2[0] = val_29;
            mem2[0] = val_45;
        }
        
        Unknown val_31 = this.newVerticies.Item[0];
        Unknown val_32 = this.newVerticies.Item[0];
        val_45 = val_45 - val_47;
        val_29 = val_29 - val_46;
        this.newVerticies2.Insert(index:  0, item:  new UnityEngine.Vector2());
        val_47 = val_47 + 1;
        if(this.newVerticies != null)
        {
            goto label_37;
        }
        
        label_22:
        this.pathPolygonCollider.SetPath(index:  0, points:  this.newVerticies2.ToArray());
        this.pathPolygonCollider.sharedMaterial = this.material;
        label_20:
        System.Collections.Generic.List<UnityEngine.Vector2> val_48 = this.newVerticies;
        val_48 = val_48 - 1;
        this.CalculatesPrevCenterOfMassAndMass(width:  (float)val_48);
        val_48 = this.pathRigidbody;
        if(this.dynamicMass != false)
        {
                val_49 = val_48.mass * this.massScale;
        }
        else
        {
                val_49 = this.massScale;
        }
        
        val_48.mass = val_49;
        int val_49 = this.centerOfMassCount;
        val_49 = this.centerOfMass / (float)val_49;
        this.centerOfMass = val_49;
        mem[1152921504930430580] = val_11.z / (float)val_49;
        if(this.newVerticies < 3)
        {
            goto label_50;
        }
        
        val_50 = this.widthStart;
        if(val_50 != 0f)
        {
            goto label_49;
        }
        
        val_50 = this.widthEnd;
        if(val_50 == 0f)
        {
            goto label_50;
        }
        
        label_49:
        this.pathRigidbody.centerOfMass = new UnityEngine.Vector2();
        label_50:
        if(this.showMassCenter != false)
        {
                UnityEngine.Vector3 val_37 = this.transform.position;
            val_41 = val_37.x;
            val_44 = mem[mem[536891277]];
            val_44 = mem[536891277];
            val_48 = this;
            this.massCenterClone = UnityEngine.Object.Instantiate<System.Object>(original:  this.massCenter, position:  new UnityEngine.Vector3() {x = val_41, y = val_37.y, z = val_37.z}, rotation:  new UnityEngine.Quaternion() {x = val_44, y = mem[536891277] + 4, z = mem[536891277] + 8, w = mem[536891277] + 8 + 4});
            this.massCenterClone.transform.parent = this.pathRigidbody.transform;
            this.massCenterClone.transform.position = new UnityEngine.Vector3() {x = this.centerOfMass, y = val_37.y, z = 0f};
        }
        
        this.pathRigidbody.bodyType = 0;
    }
    private void Update()
    {
        var val_11;
        UnityEngine.RaycastHit2D val_12;
        var val_13;
        var val_19;
        var val_20;
        UnityEngine.RaycastHit2D val_21;
        UnityEngine.Object val_30;
        float val_31;
        val_30 = UnityEngine.EventSystems.EventSystem.current;
        if(val_30 == 0)
        {
            goto label_3;
        }
        
        if(val_30.IsPointerOverGameObject() == false)
        {
            goto label_5;
        }
        
        return;
        label_3:
        label_5:
        val_30 = 27502480;
        if((System.String.op_Equality(a:  val_30.gameObject.name, b:  -1610606693)) == true)
        {
                return;
        }
        
        UnityEngine.Vector3 val_8 = this.mousePointer.transform.position;
        int val_9 = UnityEngine.LayerMask.op_Implicit(mask:  new UnityEngine.LayerMask() {m_Mask = this.layerMask});
        UnityEngine.RaycastHit2D val_10 = UnityEngine.Physics2D.Raycast(origin:  new UnityEngine.Vector2(), direction:  new UnityEngine.Vector2(), distance:  val_8.x, layerMask:  0);
        mem[1152921504930430620] = val_11;
        mem[1152921504930430604] = val_13;
        this.hit = val_12;
        UnityEngine.Vector3 val_15 = UnityEngine.Input.mousePosition;
        UnityEngine.Vector3 val_16 = UnityEngine.Camera.main.ScreenToWorldPoint(position:  new UnityEngine.Vector3() {x = val_15.x, y = val_15.y, z = val_15.z});
        val_31 = val_16.x;
        int val_17 = UnityEngine.LayerMask.op_Implicit(mask:  new UnityEngine.LayerMask() {m_Mask = this.layerMask});
        UnityEngine.RaycastHit2D val_18 = UnityEngine.Physics2D.Raycast(origin:  new UnityEngine.Vector2(), direction:  new UnityEngine.Vector2(), distance:  val_31, layerMask:  0);
        val_11 = val_19;
        val_12 = val_21;
        val_13 = val_20;
        mem[1152921504930430656] = val_19;
        this.mouseRay = val_21;
        mem[1152921504930430640] = val_20;
        if((UnityEngine.Input.GetMouseButtonDown(button:  0)) != false)
        {
                this.onTouchDown();
        }
        
        val_30 = 27342528;
        if((UnityEngine.Input.GetMouseButton(button:  0)) != false)
        {
                if(this.canDraw != false)
        {
                this.DrawSound();
        }
        
            Unknown val_24 = this.newVerticies.Item[2139095039];
            val_31 = val_20;
            UnityEngine.Vector3 val_26 = this.mousePointer.transform.position;
            if((this.canPassWhenDraw(begin:  new UnityEngine.Vector2(), end:  new UnityEngine.Vector2())) != true)
        {
                mem[536882947] + 104.Pause();
            this.drawSound = false;
        }
        
            this.onTouchMove();
        }
        
        if((UnityEngine.Input.GetMouseButtonUp(button:  0)) == false)
        {
                return;
        }
        
        mem[536882947] + 104.Pause();
        this.onTouchUp();
    }
    private void makeAPoint(UnityEngine.Vector3 position)
    {
        Unknown val_1 = UnityEngine.Object.Instantiate<System.Object>(original:  this.pointPrefab);
        val_1.transform.position = new UnityEngine.Vector3() {x = position.x, y = position.y, z = position.z};
        val_1.GetComponent<System.Object>().color = new UnityEngine.Color() {r = this.colorStart, g = position.y, b = position.z};
        Unknown val_4 = val_1.GetComponent<System.Object>();
        val_4.useAutoMass = true;
        val_4.useAutoMass = false;
        float val_8 = mem[536882291] + 88;
        val_8 = val_4.mass * val_8;
        val_4.mass = val_8;
        float val_6 = val_4.mass;
        UnityEngine.MonoBehaviour.print(message:  536892547);
        val_1.GetComponent<System.Object>().sharedMaterial = this.material;
    }
    private void GiveLog()
    {
        UnityEngine.Debug.Log(message:  -1610607653);
    }
    private void StarPrefab()
    {
        UnityEngine.PolygonCollider2D val_31;
        UnityEngine.Vector3 val_2 = this.mousePointer.transform.position;
        val_31 = this;
        this.clone = UnityEngine.Object.Instantiate<System.Object>(original:  this.path, position:  new UnityEngine.Vector3() {x = val_2.x, y = val_2.y, z = val_2.z}, rotation:  new UnityEngine.Quaternion() {x = mem[536891277], y = mem[536891277] + 4, z = mem[536891277] + 8, w = mem[536891277] + 8 + 4});
        this.clone.name = -1610608097(-1610608097) + mem[536885469].ToString();
        var val_31 = mem[536885469];
        val_31 = val_31 + 1;
        mem2[0] = val_31;
        this.pathLineRenderer = this.clone.GetComponent<System.Object>();
        this.pathRigidbody = this.clone.GetComponent<System.Object>();
        this.pathRigidbody.bodyType = 1;
        this.pathRigidbody.gravityScale = this.gravityScale;
        this.clone.transform.position = new UnityEngine.Vector3() {x = mem[536895737], y = mem[536895737] + 4, z = mem[536895737] + 8};
        this.clone.transform.rotation = new UnityEngine.Quaternion() {x = mem[536891277], y = mem[536891277] + 4, z = mem[536891277] + 8, w = mem[536891277] + 8 + 4};
        this.pathRigidbody.centerOfMass = new UnityEngine.Vector2();
        this.pathLineRenderer.SetColors(start:  new UnityEngine.Color() {r = this.colorStart, g = mem[536895699] + 4, b = mem[536891277] + 8, a = mem[536891277] + 8 + 4}, end:  new UnityEngine.Color() {r = this.colorEnd, g = mem[536891277] + 8, b = mem[536891277] + 8 + 4});
        this.pathLineRenderer.SetWidth(start:  this.widthStart, end:  this.widthEnd);
        val_31 = val_31 + 1;
        mem2[0] = 0;
        mem2[0] = val_31;
        val_31 = val_31 + 1;
        mem2[0] = 0;
        mem2[0] = val_31;
        System.Collections.Generic.List<UnityEngine.Vector2> val_32 = this.newVerticies2;
        val_31 = val_31 + 1;
        mem2[0] = 0;
        mem2[0] = val_31;
        this.pathLineRenderer.SetVertexCount(count:  1);
        UnityEngine.Vector3 val_11 = this.mousePointer.transform.position;
        UnityEngine.Vector3 val_14 = UnityEngine.Camera.main.transform.position;
        val_14.z = val_11.z - val_14.z;
        this.pathLineRenderer.SetPosition(index:  0, position:  new UnityEngine.Vector3() {x = val_11.x, y = val_11.y, z = val_14.z});
        UnityEngine.Vector3 val_16 = this.mousePointer.transform.position;
        UnityEngine.Vector3 val_18 = this.clone.transform.position;
        var val_19 = W10 + 1;
        mem2[0] = val_19;
        val_18.x = val_16.x - val_18.x;
        val_18.y = val_16.y - val_18.y;
        if(val_19 < W11)
        {
                val_32 = val_32 + (((W10 + 1)) << 3);
            mem2[0] = val_19 + 1;
            mem2[0] = val_18.x;
            mem2[0] = val_18.y;
        }
        else
        {
                var val_33 = mem[3221259943] + 192 + 88 + 8;
        }
        
        UnityEngine.Vector3 val_22 = this.mousePointer.transform.position;
        UnityEngine.Vector3 val_24 = this.clone.transform.position;
        val_19 = val_19 + 1;
        mem2[0] = val_19;
        val_24.x = val_22.x - val_24.x;
        val_24.y = val_22.y - val_24.y;
        if(val_19 < (mem[3221259943] + 192 + 88 + 8 + 24))
        {
                val_33 = val_33 + ((((W10 + 1) + 1)) << 3);
            mem2[0] = val_19 + 1;
            mem2[0] = val_24.x;
            mem2[0] = val_24.y;
        }
        
        if(this.colliderType == 1)
        {
                UnityEngine.Object.Destroy(obj:  this.clone.GetComponent<System.Object>());
            this.pathEdgeCollider = this.clone.GetComponent<System.Object>();
        }
        else
        {
                UnityEngine.Object.Destroy(obj:  this.clone.GetComponent<System.Object>());
            this.pathPolygonCollider = this.clone.GetComponent<System.Object>();
            val_31 = this.pathPolygonCollider;
            val_31.SetPath(index:  0, points:  val_32.ToArray());
        }
        
        this.pathPolygonCollider.isTrigger = true;
    }
    private void DrawVisibleLine()
    {
        float val_46;
        float val_47;
        System.Collections.Generic.List<UnityEngine.Vector2> val_57;
        float val_58;
        UnityEngine.Vector3 val_2 = this.mousePointer.transform.position;
        Unknown val_3 = this.newVerticies_.Item[this.posCount];
        float val_57 = val_2.x;
        val_57 = val_2.x - val_57;
        val_2.x = val_57 * val_57;
        val_2.x = val_2.x + ((val_2.y - val_2.y) * (val_2.y - val_2.y));
        if(val_2.x <= this.verticesDistance)
        {
                return;
        }
        
        Unknown val_7 = this.newVerticies.Item[mem[536889581] - 1];
        UnityEngine.Vector3 val_9 = this.mousePointer.transform.position;
        if((this.canPassWhenDraw(begin:  new UnityEngine.Vector2(), end:  new UnityEngine.Vector2())) == false)
        {
            goto label_10;
        }
        
        mem2[0] = 1;
        this.setBlockLineVisiable(visiable:  false);
        int val_58 = this.posCount;
        this.posCount = val_58 + 1;
        this.pathLineRenderer.SetVertexCount(count:  val_58 + 2);
        UnityEngine.Vector3 val_14 = this.mousePointer.transform.position;
        UnityEngine.Vector3 val_17 = UnityEngine.Camera.main.transform.position;
        val_17.z = val_14.z - val_17.z;
        this.pathLineRenderer.SetPosition(index:  this.posCount, position:  new UnityEngine.Vector3() {x = val_14.x, y = val_14.y, z = val_17.z});
        UnityEngine.Vector3 val_19 = this.mousePointer.transform.position;
        UnityEngine.Vector3 val_21 = this.clone.transform.position;
        var val_22 = W10 + 1;
        mem2[0] = val_22;
        val_21.x = val_19.x - val_21.x;
        val_21.y = val_19.y - val_21.y;
        if(val_22 >= (this.posCount + 24))
        {
            goto label_24;
        }
        
        val_58 = val_58 + (((W10 + 1)) << 3);
        mem2[0] = val_22 + 1;
        mem2[0] = val_21.x;
        mem2[0] = val_21.y;
        goto label_25;
        label_10:
        Unknown val_25 = this.newVerticies.Item[mem[536889581] - 1];
        UnityEngine.Vector3 val_27 = UnityEngine.Input.mousePosition;
        UnityEngine.Vector3 val_28 = UnityEngine.Camera.main.ScreenToWorldPoint(position:  new UnityEngine.Vector3() {x = val_27.x, y = val_27.y, z = val_27.z});
        this.setBlockLine(begin:  new UnityEngine.Vector3() {x = val_2.x, y = this.verticesDistance, z = 0f}, end:  new UnityEngine.Vector3() {x = val_28.x, y = val_28.y, z = val_28.z});
        return;
        label_24:
        var val_59 = mem[3221259943] + 192 + 88 + 8;
        label_25:
        val_57 = this.newVerticies;
        UnityEngine.Vector3 val_30 = this.mousePointer.transform.position;
        val_58 = val_30.x;
        UnityEngine.Vector3 val_32 = this.clone.transform.position;
        val_22 = val_22 + 1;
        mem2[0] = val_22;
        val_32.x = val_58 - val_32.x;
        val_32.y = val_30.y - val_32.y;
        if(val_22 < (mem[3221259943] + 192 + 88 + 8 + 24))
        {
                val_59 = val_59 + ((((W10 + 1) + 1)) << 3);
            mem2[0] = val_22 + 1;
            mem2[0] = val_32.x;
            mem2[0] = val_32.y;
        }
        
        if(this.colliderType != 1)
        {
            goto label_36;
        }
        
        if(this.colliderType >= 3)
        {
                val_57 = this.pathEdgeCollider;
            val_57.points = this.newVerticies.ToArray();
        }
        
        if(this.pathEdgeCollider != null)
        {
            goto label_40;
        }
        
        label_36:
        System.Collections.Generic.List<UnityEngine.Vector2> val_60 = this.newVerticies2;
        mem2[0] = 0;
        mem2[0] = 3221259912;
        UnityEngine.Vector3 val_36 = this.mousePointer.transform.position;
        val_58 = val_36.x;
        UnityEngine.Vector3 val_38 = this.clone.transform.position;
        var val_67 = -1073707385;
        val_22 = val_22 + 1;
        mem2[0] = val_22;
        val_38.x = val_58 - val_38.x;
        val_38.y = val_36.y - val_38.y;
        if(val_22 < (mem[3221259943] + 192 + 88 + 8 + 24))
        {
                val_60 = val_60 + (((((W10 + 1) + 1) + 1)) << 3);
            mem2[0] = val_22 + 1;
            mem2[0] = val_38.x;
            mem2[0] = val_38.y;
        }
        
        int val_61 = 0;
        label_65:
        if(val_61 >= 20180991)
        {
            goto label_52;
        }
        
        Unknown val_40 = this.newVerticies.Item[0];
        val_61 = val_61 + 1;
        Unknown val_41 = this.newVerticies.Item[val_61];
        val_61 = val_61 - 1;
        Unknown val_42 = this.newVerticies.Item[val_61];
        val_61 = val_61 + 1;
        Unknown val_43 = this.newVerticies.Item[val_61];
        float val_45 = val_38.x - val_38.x;
        float val_62 = val_38.y - val_38.y;
        val_62 = val_62 + 1.570796f;
        this.colliderAngle = val_62;
        float val_64 = val_46;
        float val_65 = val_47;
        val_61 = val_61 - 1;
        Unknown val_48 = this.newVerticies.Item[val_61];
        float val_63 = (float)val_61;
        val_63 = val_63 / ((float)W27 - 2);
        float val_66 = 1f;
        Unknown val_51 = this.newVerticies.Item[val_61];
        val_22 = val_22 + 1;
        mem2[0] = val_22;
        float val_52 = this.widthEnd - this.widthStart;
        val_52 = val_52 * ((val_63 >= 0) ? (val_66) : 0f);
        val_52 = this.widthStart + val_52;
        val_52 = val_52 * 0.5f;
        val_64 = val_64 * val_52;
        val_65 = val_65 * val_52;
        val_52 = val_62 + val_64;
        val_66 = val_65 + val_66;
        if(val_22 < mem[3221259935])
        {
                val_67 = val_67 + ((((((W10 + 1) + 1) + 1) + 1)) << 3);
            mem2[0] = val_22 + 1;
            mem2[0] = val_52;
            mem2[0] = val_66;
        }
        
        Unknown val_54 = this.newVerticies.Item[val_61];
        Unknown val_55 = this.newVerticies.Item[val_61];
        val_66 = val_66 - val_65;
        val_52 = val_52 - val_64;
        this.newVerticies2.Insert(index:  0, item:  new UnityEngine.Vector2());
        val_61 = val_61 + 1;
        if(this.newVerticies != null)
        {
            goto label_65;
        }
        
        label_52:
        this.newVerticies.RemoveAt(index:  20180991);
        val_57 = this.pathPolygonCollider;
        val_57.SetPath(index:  0, points:  this.newVerticies2.ToArray());
        label_40:
        this.pathPolygonCollider.sharedMaterial = this.material;
    }
    private void CalculatesPrevCenterOfMassAndMass(float width)
    {
        var val_10;
        float val_11;
        float val_12;
        val_11 = -2f;
        float val_1 = width + val_11;
        if(val_1 >= 0f)
        {
                do
        {
            Unknown val_2 = this.newVerticies.Item[0];
            int val_3 = 0 + 1;
            val_12 = V1.16B;
            Unknown val_4 = this.newVerticies.Item[val_3];
            float val_11 = val_11;
            val_11 = val_11 - val_11;
            float val_5 = val_12 - V1.16B;
            val_11 = val_11 * val_11;
            val_11 = val_11 + (val_5 * val_5);
            val_5 = val_11 * (float)this.massCenterPrecision;
            if(val_5 >= 0f)
        {
                do
        {
            Unknown val_7 = this.newVerticies.Item[0];
            Unknown val_8 = this.newVerticies.Item[val_3];
            int val_12 = this.centerOfMassCount;
            val_11 = val_11 - val_11;
            val_11 = val_11 * 0.5f;
            val_11 = val_11 + val_11;
            val_12 = val_12 + 1;
            val_12 = this.centerOfMass + val_11;
            var val_9 = 1 + 1;
            this.centerOfMassCount = val_12;
            this.centerOfMass = val_12;
        }
        while(val_5 >= 1f);
        
        }
        
            val_11 = (float)val_3;
            val_10 = val_3;
        }
        while(val_1 >= val_11);
        
        }
        
        if(this.dynamicMass == false)
        {
                return;
        }
        
        if(this.newVerticies < 3)
        {
                return;
        }
        
        float val_10 = this.pathRigidbody.mass;
        val_10 = val_10 + width;
        this.pathRigidbody.mass = val_10;
    }
    private bool fixGetMouseButtonDown()
    {
        return UnityEngine.Input.GetMouseButtonDown(button:  0);
    }
    private bool fixGetMouseButton()
    {
        return UnityEngine.Input.GetMouseButton(button:  0);
    }
    private bool fixGetMouseButtonUp()
    {
        return UnityEngine.Input.GetMouseButtonUp(button:  0);
    }
    private bool isClickOnUI()
    {
        return UnityEngine.EventSystems.EventSystem.current.IsPointerOverGameObject();
    }
    private UnityEngine.Vector3 getTouchPosition()
    {
        return UnityEngine.Input.mousePosition;
    }
    public bool canPassWhenDraw(UnityEngine.Vector2 begin, UnityEngine.Vector2 end)
    {
        float val_21 = V3.16B;
        float val_20 = V2.16B;
        if(this.blockLine.gameObject.active != true)
        {
                this.blockLine.gameObject.SetActive(value:  true);
        }
        
        float val_6 = (V0.16B - val_20) * (V0.16B - val_20);
        val_6 = val_6 + ((V1.16B - val_21) * (V1.16B - val_21));
        val_20 = val_20 - V0.16B;
        val_21 = val_21 - V1.16B;
        if(val_8.Length == 0)
        {
                return false;
        }
        
        if(val_8.Length < 1)
        {
                return false;
        }
        
        var val_23 = 0;
        label_24:
        if(val_23 >= val_8.Length)
        {
            goto label_12;
        }
        
        UnityEngine.RaycastHit2D val_22 = UnityEngine.Physics2D.RaycastAll(origin:  new UnityEngine.Vector2(), direction:  new UnityEngine.Vector2(), distance:  V0.16B)[32];
        if(null.collider.gameObject != this.mousePointer)
        {
                if((null.collider.gameObject.name.Contains(value:  -1610608097)) != true)
        {
                if((null.collider.gameObject.GetComponent<System.Object>()) == 0)
        {
                return false;
        }
        
        }
        
        }
        
        val_23 = val_23 + 1;
        if(val_23 < (val_8.Length << ))
        {
            goto label_24;
        }
        
        return false;
        label_12:
    }
    public void setBlockLineVisiable(bool visiable)
    {
        this.blockLine.gameObject.SetActive(value:  visiable);
    }
    private void DrawSound()
    {
        if(this.drawSound == true)
        {
                return;
        }
        
        mem[536882947] + 104.Play();
        this.drawSound = true;
    }
    public DrawingManager()
    {
        System.Collections.Generic.List<UnityEngine.Vector2> val_1 = 536903815;
        val_1 = new System.Collections.Generic.List<UnityEngine.Vector2>();
        this.newVerticies = val_1;
        System.Collections.Generic.List<UnityEngine.Vector2> val_2 = 536903815;
        val_2 = new System.Collections.Generic.List<UnityEngine.Vector2>();
        this.newVerticies2 = val_2;
        System.Collections.Generic.List<UnityEngine.Vector2> val_3 = 536903815;
        val_3 = new System.Collections.Generic.List<UnityEngine.Vector2>();
        this.newVerticies_ = val_3;
        this.canDraw = true;
        this.centerOfMass = mem[536895699];
        this.tagCantDraw = mem[536893213];
        this.tagsCantdraw = 536881467;
    }

}
